﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace MessageSystem.Default.Interface
{
    public unsafe struct Message
    {
        [StructLayout(LayoutKind.Explicit, Size = 16)]
        public struct MessageHead
        {
            public static int Size = 16;
            public static MessageHead* Null = (MessageHead*)0;

            [FieldOffset(0)]
            public UInt16 TotalLength;
            [FieldOffset(2)]
            public UInt16 Flags;
            [FieldOffset(4)]
            public int    MessageId;
            [FieldOffset(8)]
            public int    SessionId;
            [FieldOffset(12)]
            public int    OpCode;
        }

        public MessageHead Head;
        public byte*       Body;
        public int         BodyLength;
    }
}
